<template>
	<div class="aid">
		<div class="base">
			<p class="fixed-top">
				诚信值记录
				<a-icon @click="closeFunction" type="close" />
			</p>
			<el-table :data="dataList" border :max-height="300" highlight-current-row style="width: 100%;margin-top: 49px;">
				<el-table-column type="index" label="序号" width="60" fixed="left" align="center"></el-table-column>
				<el-table-column prop="Score" label="诚信值" min-width="100"></el-table-column>
				<el-table-column prop="RemainScore" label="剩余诚信值" min-width="100"></el-table-column>
				
				<el-table-column prop="ActivityName" label="活动名称" min-width="100" ></el-table-column>
				<el-table-column prop="AddUserName" label="类型" min-width="100">
					<template slot-scope="scope">
						{{isAssistantList[(scope.row.Type)-1].Name}}
					</template>
				</el-table-column>
				
				<el-table-column prop="AddTime" label="添加时间" min-width="100"></el-table-column>
			</el-table>
			<el-pagination
			style="margin-right: 10px;"
				@size-change="handleSizeChange"
				@current-change="handleCurrentChange"
				:current-page="pagination.currentPage"
				:page-sizes="pagination.pageSizeOptions"
				:page-size="pagination.pageSize"
				layout="total, sizes, prev, pager, next, jumper"
				:total="pagination.total"
			></el-pagination>
			<a-form-model-item label="" class="fixed-bottom" style="padding: 10px !important;">
				<a-button type="primary" @click="closeFunction" style="margin-right: 0 !important;">确定</a-button>
			</a-form-model-item>
		</div>
	</div>
</template>

<script>
	import Cache from '@/utils/cache';
	import { UserCenterDoGetUserHonestyList } from '@/api/follow';
	
	export default {
		props: {
			// dataList: Array
		},
		watch: {
			// dataList: function(text) {

			// }
		},
		created() {
			this.getList();
		},
		data() {
			return {
				dataList:[],
				isAssistantList: [{
						ID: "1",
						Name: '活动爽约'
					},
					{
						ID: "2",
						Name: '正常参加活动'
					}
				],
				pagination: {
					currentPage: 1,
					pageSize: this.global.pageSize,
					pageSizeOptions: this.global.pageSizeOptions, // 每页中显示的数据
					showTotal: total => `共有 ${total} 条数据` // 分页中显示总的数据
				},
			};
		},
		methods: {
			handleSizeChange(val) {
				this.pagination.pageSize = val;
				this.getList();
			},
			handleCurrentChange(val) {
				this.pagination.currentPage = val;
				this.getList();
			},
			async getList() {
				this.loading = true;
				let data = {};
			
				data.pageIndex = this.pagination.currentPage;
				data.pageSize = this.pagination.pageSize;
				let res = await UserCenterDoGetUserHonestyList(data);
				this.loading = false;
				this.dataList = res.data.data;
				const pagination = { ...this.pagination };
				pagination.total = res.data.pageInfo.TotalItemCount;
				this.pagination = pagination;
				// this.$refs.tableForm.bodyWrapper.scrollTop = 0
			},
			closeFunction(data) {
				this.$emit('closeFun',data);
			}
		}
	};
</script>

<style lang="less" scoped>
	.fixed-bottom{
		padding: 10px !important;
	}
	/deep/.ant-form-item {
		display: flex;
		margin-bottom: 10px !important;
	}

	/deep/.ant-form-item-label {
		width: 80px;
		overflow: hidden;
		white-space: nowrap;
		text-overflow: ellipsis;
		text-align: right;
	}

	/deep/.ant-form-item-control-wrapper {
		flex: 1;
	}

	/deep/.ant-calendar-picker {
		width: 100%;
	}
	.aid .base{
		width: 800px;
		height: 480px;
		margin-left: -400px;
		margin-top: -200px;
		top: 50%;
	}
</style>
